using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class NatureofServiceTestObservationAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public NatureofServiceTestObservationAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v23] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v231] = HL7TableType.User;
						tableVersionTypes[HL7Version.v24] = HL7TableType.User;
						tableVersionTypes[HL7Version.v25] = HL7TableType.User;
						tableVersionTypes[HL7Version.v251] = HL7TableType.User;
						tableVersionTypes[HL7Version.v26] = HL7TableType.User;
						tableVersionTypes[HL7Version.v27] = HL7TableType.User;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v23] = new string[]{"A","C","F","P","S"};
						validVersionCodes[HL7Version.v231] = new string[]{"P","F","A","S","C"};
						validVersionCodes[HL7Version.v24] = new string[]{"P","F","A","S","C"};
						validVersionCodes[HL7Version.v25] = new string[]{"P","F","A","S","C"};
						validVersionCodes[HL7Version.v251] = new string[]{"P","F","A","S","C"};
						validVersionCodes[HL7Version.v26] = new string[]{"P","F","A","S","C"};
						validVersionCodes[HL7Version.v27] = new string[]{"P","F","A","S","C"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v23] = new string[]{"Atomic test/observation (test code or treatment code)","Single observation calculated via a rule or formula from other independent observations (e.g., Alveolar--arterial ratio, cardiac output)","Functional procedure that may consist of one or more interrelated measures (e.g., glucose tolerance test, creatine clearance), usually done at different times and/or on different specimens","Profile or battery consisting of many independent atomic observations (e.g., SMA12, electrolytes), usually done at one instrument on one specimen","Superset--a set of batteries or procedures ordered under a single code unit but processed as separate batteries (e.g., routines = CBC, UA, electrolytes)"};
						validVersionDescriptions[HL7Version.v231] = new string[]{"Profile or battery consisting of many independent atomic observations (e.g., SMA12, electrolytes), usually done at one instrument on one specimen","Functional procedure that may consist of one or more interrelated measures (e.g., glucose tolerance test, creatine clearance), usually done at different times and/or on different specimens","Atomic test/observation (test code or treatment code)","Superset--a set of batteries or procedures ordered under a single code unit but processed as separate batteries (e.g., routines = CBC, UA, electrolytes)","Single observation calculated via a rule or formula from other independent observations (e.g., Alveolar--arterial ratio, cardiac output)"};
						validVersionDescriptions[HL7Version.v24] = new string[]{"Profile or battery consisting of many independent atomic observations (e.g., SMA12, electrolytes), usually done at one instrument on one specimen","Functional procedure that may consist of one or more interrelated measures (e.g., glucose tolerance test, creatinine clearance), usually done at different times and/or on different specimens","Atomic service/test/observation (test code or treatment code)","Superset--a set of batteries or procedures ordered under a single code unit but processed as separate batteries (e.g., routines = CBC, UA, electrolytes); This set indicates that the code being described is used to order multiple service/test/observation b","Single observation calculated via a rule or formula from other independent observations (e.g., Alveolar--arterial ratio, cardiac output)"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Profile or battery consisting of many independent atomic observations (e.g., SMA12, electrolytes), usually done at one instrument on one specimen","Functional procedure that may consist of one or more interrelated measures (e.g., glucose tolerance test, creatinine clearance), usually done at different times and/or on different specimens","Atomic service/test/observation (test code or treatment code)","Superset--a set of batteries or procedures ordered under a single code unit but processed as separate batteries (e.g., routines = CBC, UA, electrolytes)","Single observation calculated via a rule or formula from other independent observations (e.g., Alveolar--arterial ratio, cardiac output)"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Profile or battery consisting of many independent atomic observations (e.g., SMA12, electrolytes), usually done at one instrument on one specimen","Functional procedure that may consist of one or more interrelated measures (e.g., glucose tolerance test, creatinine clearance), usually done at different times and/or on different specimens","Atomic service/test/observation (test code or treatment code)","Superset--a set of batteries or procedures ordered under a single code unit but processed as separate batteries (e.g., routines = CBC, UA, electrolytes)<p>This set indicates that the code being described is used to order multiple service/test/observation ","Single observation calculated via a rule or formula from other independent observations (e.g., Alveolar--arterial ratio, cardiac output)"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Profile or battery consisting of many independent atomic observations (e.g., SMA12, electrolytes), usually done at one instrument on one specimen","Functional procedure that may consist of one or more interrelated measures (e.g., glucose tolerance test, creatinine clearance), usually done at different times and/or on different specimens","Atomic service/test/observation (test code or treatment code)","Superset-a set of batteries or procedures ordered under a single code unit but processed as separate batteries (e.g., routines = CBC, UA, electrolytes)<p>This set indicates that the code being described is used to order multiple service/test/observation b","Single observation calculated via a rule or formula from other independent observations (e.g., Alveolar-arterial ratio, cardiac output)"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Profile or battery consisting of many independent atomic observations (e.g., SMA12, electrolytes), usually done at one instrument on one specimen","Functional procedure that may consist of one or more interrelated measures (e.g., glucose tolerance test, creatinine clearance), usually done at different times and/or on different specimens","Atomic service/test/observation (test code or treatment code)","Superset-a set of batteries or procedures ordered under a single code unit but processed as separate batteries (e.g., routines = CBC, UA, electrolytes)<p>This set indicates that the code being described is used to order multiple service/test/observation b","Single observation calculated via a rule or formula from other independent observations (e.g., Alveolar-arterial ratio, cardiac output)"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
